<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5"
>
<head>
    <meta charset="UTF-8">
    <title>main</title>
</head>
<body>
        <p><input type="text" th:value="${_csrf.token}" name="_csrf" th:if="${_csrf}"></p>
        <p>登录账号<span sec:authentication="name"></span></p>
        <p>登录账号<span sec:authentication="principal.username"></span></p>
        <p>凭证<span sec:authentication="credentials"></span></p>
        <p>权限和角色<span sec:authentication="authorities"></span></p>
        <p>客户端地址<span sec:authentication="details.remoteAddress"></span></p>
        <p>sessionid<span sec:authentication="details.sessionId"></span></p>
        <br>
        通过权限判断<br>
        <button sec:authorize="hasAuthority('/insert')">新增</button>
        <button sec:authorize="hasAuthority('/delete')">删除</button>
        <button sec:authorize="hasAuthority('/update')">修改</button>
        <button sec:authorize="hasAuthority('/select')">查看</button>

        <br>
        通过角色判断<br>
        <button sec:authorize="hasRole('gm')">新增</button>
        <button sec:authorize="hasRole('gm')">删除</button>
        <button sec:authorize="hasRole('gm')">修改</button>
        <button sec:authorize="hasRole('gm')">查看</button>


        <a href="main1.html">跳转main1</a>
</body>
</html>